﻿<UserControl x:Class="Shazzam.Controls.TexturePicker"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight='120'
             d:DesignWidth='603'
             VerticalAlignment="Top">
  <UserControl.Resources>
   
    <DataTemplate x:Key="TextureMapDataTemplate2">
      <StackPanel Orientation='Horizontal'
                  Background="Black"
                  HorizontalAlignment="Center"
                  VerticalAlignment="Center">
        <Border  BorderBrush="{StaticResource VeryLightBrush}"
                 BorderThickness="4"
                 Margin="2"
                 VerticalAlignment='Center'
                 Grid.Column="1"
                 d:LayoutOverrides="Width"
                 Padding="2"
                 HorizontalAlignment="Center">
          <Image Height='60'
                 HorizontalAlignment='Center'
                 Name='image1'
                 Stretch='UniformToFill'
                 VerticalAlignment='Center'
                 Width='80'
                 Source='{Binding LongFileName}'
                 ToolTipService.Placement='Center'
                 ToolTipService.VerticalOffset='-210'>
          	
   

            <Image.ToolTip>
              <Grid Width="400"
                    Height="300"
                    Background="Black">

                <Image Height='298'
                       HorizontalAlignment='Center'
                       Name='image2'
                       Stretch='UniformToFill'
                       VerticalAlignment='Center'
                       Width='398'
                       Source='{Binding LongFileName}' />
                <TextBlock Foreground='{StaticResource VeryLightBrush}'
                           Margin='4'
                           FontSize='24'
                           Background='#00FFFFFF'
                           Text='{Binding ShortFileName}' />
              </Grid>
            </Image.ToolTip>

          </Image>
        </Border>
      </StackPanel>
    </DataTemplate>
    <ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
      <VirtualizingStackPanel Orientation="Horizontal" />
    </ItemsPanelTemplate>
  </UserControl.Resources>
  <Grid Name='mainGrid'>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="Auto"
                        MinWidth="104.832" />
      <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Border  BorderBrush="{StaticResource VeryLightBrush}"
             BorderThickness="4"
             Margin="2,2,2,0"
             VerticalAlignment='Top'
             Grid.Column="1"
             HorizontalAlignment='Center'
             d:LayoutOverrides="Width">

      <Image Height='60'
             HorizontalAlignment='Left'
             Name='image1'
             Stretch='UniformToFill'
             VerticalAlignment='Top'
             Width='80'
             Source="/Shazzam;component/Images/cactus.jpg">
        <Image.ToolTip>
          <Grid Width="400"
                Height="300"
                Background="Black">
            <Image Height='298'
                   HorizontalAlignment='Center'
                   Name='image2'
                   Stretch='UniformToFill'
                   VerticalAlignment='Center'
                   Width='398'
                   Source="/Shazzam;component/Images/cactus.jpg" />
          </Grid>
        </Image.ToolTip>
      </Image>
    </Border>
    <StackPanel>

      <TextBlock TextWrapping="Wrap"
                 Text='Choose Image File'
                 HorizontalAlignment="Center"
                 Foreground="{DynamicResource NeutralWhiteBrush}"
                 Margin="0,3,0,0">
            	<TextBlock.Background>
            		<ImageBrush />
            	</TextBlock.Background>
      </TextBlock>

      <Button Content='Open File...'
              Height='23'
              HorizontalAlignment='Center'
              Margin="12"
              x:Name='OpenImageButton'
              VerticalAlignment='Top'
              Width='75'
              Click='btnOpenImage_Click'
              Grid.Column="0" />
      <Popup x:Name="popSelectTexture"
             StaysOpen='False'
             PlacementTarget='{Binding ElementName=this}'
             Placement='Left'
             HorizontalOffset='-160'>
        <Grid Background="Gray"
              Height="106"
              Width="600">
          <ListBox Margin="2,2,2,2"
                   x:Name='IncludedTexturesList'
                   ItemTemplate="{DynamicResource TextureMapDataTemplate2}"
                   ItemsPanel="{DynamicResource ItemsPanelTemplate1}"
                   SelectionChanged="IncludedTextures_SelectionChanged" />
        </Grid>
      </Popup>
    </StackPanel>
    <StackPanel Grid.Column="2"
                HorizontalAlignment="Left"
                Orientation="Vertical"
                d:LayoutOverrides="Height">
      <TextBlock TextWrapping="Wrap"
                 Text='Shazzam Texture Map'
                 HorizontalAlignment="Center"
                 Foreground="{DynamicResource NeutralWhiteBrush}"
                 Margin="0,3,0,0">
        		<TextBlock.Background>
        			<ImageBrush />
        		</TextBlock.Background>
      </TextBlock>
      <Button Content='Choose Texture'
              Height='23'
              HorizontalAlignment='Center'
              Margin="12"
              x:Name='chooseTexture'
              VerticalAlignment='Top'
              Click='chooseTexture_click' />

    </StackPanel>

    <Grid.Background>
      <LinearGradientBrush EndPoint="1,0.5"
                           StartPoint="0,0.5">
        <GradientStop Color="{StaticResource VeryDark}"
                      Offset=".5" />
        <GradientStop Color="{StaticResource NeutralDark}"
                      Offset="1" />
      </LinearGradientBrush>
    </Grid.Background>
  </Grid>
</UserControl>
